#!/bin/bash

latest=2022.2.2
latestcommit=5140d2205fd87c8f6d2ade9c77b24fca63502742

if [ -z "$1" ]
then
  echo -e "\033[31m未指定版本\033[0m"
  echo -e "\033[35m开始打包最新版本 >>> $latest\033[0m"
  git reset --hard $latestcommit
  sleep 1
  mvn clean install
  sleep 1
  git rebase master
  echo -e "\033[36m打包完成\033[0m"
elif [ "$1" == "$latest" ]
then
  echo -e "\033[35m开始打包指定版本 >>> $latest\033[0m"
  git reset --hard $latestcommit
  sleep 1
  mvn clean install
  sleep 1
  git rebase master
  echo -e "\033[36m打包完成\033[0m"
elif [ "$1" == "2022.2.2" ]
then
  echo -e "\033[35m开始打包指定版本 >>> 2022.2.2\033[0m"
  git reset --hard 5140d2205fd87c8f6d2ade9c77b24fca63502742
  sleep 1
  mvn clean install
  sleep 1
  git rebase master
  echo -e "\033[36m打包完成\033[0m"
else
  echo -e "\033[31m无指定版本\033[0m"
  echo -e "\033[35m开始打包最新版本 >>> $latest\033[0m"
  git reset --hard $latestcommit
  sleep 1
  mvn clean install
  sleep 1
  git rebase master
  echo -e "\033[36m打包完成\033[0m"
fi
